﻿package core.image.psd
{
    import flash.utils.*;

    public class ImageResource extends Object
    {
        public var OsType:String = "";
        public var Name:String = "";
        public var Id:int = 0;
        public var Data:ByteArray;

        public function ImageResource()
        {
            this.Data = new ByteArray();
            return;
        }// end function

        public static function Load(core.image.psd:ImageResource:ByteArrayReader) : ImageResource
        {
            var _loc_2:* = new ImageResource;
            _loc_2.OsType = core.image.psd:ImageResource.ReadChars(4);
            if (_loc_2.OsType != "8BIM" && _loc_2.OsType != "MeSa")
            {
                return _loc_2;
            }
            _loc_2.Id = core.image.psd:ImageResource.ReadInt16();
            _loc_2.Name = core.image.psd:ImageResource.ReadPascalString();
            var _loc_3:* = core.image.psd:ImageResource.ReadUInt32();
            _loc_2.Data = core.image.psd:ImageResource.Read(_loc_3 as int);
            if (core.image.psd:ImageResource.Position % 2 == 1)
            {
                core.image.psd:ImageResource.ReadByte();
            }
            return _loc_2;
        }// end function

    }
}
